package com.easybuy.Tools;

import com.easybuy.pojo.Product;

import java.io.Serializable;

public class Wares implements Serializable {
    private Integer orderId;//订单id
    private int id;//商品id
    private String name;//商品名称
    private double price;//商品价格
    private String fileName;//商品图片
    private int quantity=1;//数量
    private int stock;//库存
    private double cost;//总价

    public void setWares(Product product){//一键封装
        id=product.getId();
        stock=product.getStock();
        name=product.getName();
        price=product.getPrice();
        fileName=product.getFileName();
        cost=price*quantity;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
        cost=price*quantity;
    }


    public double getCost() {
        return cost;
    }

    public void setCost(double cost) {
        this.cost = cost;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getStock() {
        return stock;
    }

    public void setStock(int stock) {
        this.stock = stock;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }
}
